package com.jamelli.springbootadmin;

import com.jamelli.springbootadmin.util.IpUtil;
import de.codecentric.boot.admin.server.config.EnableAdminServer;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.Environment;

/**
 * admin监控服务
 *
 * @author jamel.li
 * @create 2022/6/7 15:07
 */
@Slf4j
@EnableAdminServer // 开启 springboot admin 服务端
@SpringBootApplication
public class SpringBootAdminApplication {

    public static void main(String[] args) {
        ConfigurableApplicationContext application = SpringApplication.run(SpringBootAdminApplication.class, args);
        Environment env = application.getEnvironment();
        log.info("\n----------------------------------------------------------\n\t" +
                        "应用 '{}' 启动成功! 访问连接:\n\t" +
                        "Spring Boot Admin监控: \t\thttp://{}:{}/\n" +
                        "----------------------------------------------------------",
                env.getProperty("spring.application.name"),
                IpUtil.getServerIp(),
                env.getProperty("server.port"));
    }

}
